<%@page import="com.ereport.entity.PublishNews"%>
<%@page import="java.util.List"%>
<%@page import="com.ereport.entity.NewsUpdate"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="<%=application.getContextPath() %>/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-1.6.min.js"></script>	
<script language="javascript" src="<%=application.getContextPath() %>/js/calendar_eu.js"></script>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery-ui-1.8.17.custom.css"/>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>
</head>
<body>
<table width="927" style="height:880px" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="116" align="left" valign="top" background="<%=application.getContextPath() %>/images/top-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
    <%@ include file="../common/exe-header.jsp" %>
    </td>
  </tr>
  <tr>
    <td  align="center" valign="top"><table width="927" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="20">&nbsp;</td>
        <td width="643" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" valign="top">&nbsp;<a href="<%=application.getContextPath() %>/user/open.do"><img src="<%=application.getContextPath() %>/images/home1.jpg" width="20" height="20" border="0" /></a></td>
              <td width="8%" align="center"><a href="<%=application.getContextPath() %>/user/logout.do" style="font-family: sans-serif;">&nbsp;&nbsp;Logout</a></td>
            </tr>
          </table>
        </td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td width="20">&nbsp;</td>
        <td align="center" valign="top" class="heading">News</td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="right"></td>
        <td>&nbsp;</td>
      </tr>
      <%
      if(request.getParameter("msg")!=null){
      	out.println(request.getParameter("msg"));
      }
      %>
      <%
      if(request.getAttribute("msg")!=null){
      	out.println(request.getAttribute("msg"));
      }
      %>
      <tr>
        <td>&nbsp;</td>
        <td align="center" valign="top">
        <div id="publishNews">
        <form action="<%=application.getContextPath() %>/newsUpdate/publish.do" method="post" name="newsForm" id="newsForm">
        <table width="870" border="0" cellspacing="0" cellpadding="0">
       <tr>
            <td align="left" valign="top">
           <table width="895" border="0" align="center" cellpadding="0" cellspacing="0">
             <tr>
                <td height="10" align="left" valign="top">
                	<%@ include file="../common/newsMenu.jsp" %>
                </td>
              </tr>
              <tr>
                <td>
                
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="box-border1">
                  <tr>
                    <td width="366"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="29">&nbsp;</td>
                          <td width="168">&nbsp;</td>
                          <td width="250">&nbsp;</td>
                          <td width="23">&nbsp;</td>
                        </tr>
                        <%
                        NewsUpdate nu=(NewsUpdate)request.getAttribute("news");
                        %>
                        <tr>
                          <td height="28">&nbsp;</td>
                          <td align="left" valign="top" class="content" style="font-weight: bold;">Head Line:</td>
                          <td align="left" valign="top" class="content">
                          <input type="hidden" name="newsid" id="newsid" value="<%=nu.getId()%>"/>
                          <%=nu.getHeadLine() %></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content" style="font-weight: bold;">Literature: </td>
                          <td align="left" valign="top" class="content">
                          <%=nu.getLiterature() %>
                          </td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content" style="font-weight: bold;">Action To Be Taken:</td>
                          <td align="left" valign="top" class="content">
                          <%=nu.getActionToBeTaken() %></td>
                          <td align="left" valign="top">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                 </table></td>
                    <td width="330" align="left" valign="top"></td>
                  </tr>
                </table>
               </td>
              </tr>
              <tr>
                <td height="10" align="left" valign="top"></td>
              </tr>
              <%
              List<Executives> exlist=(List<Executives>)request.getAttribute("exlist");
              List<PublishNews> pnlist=(List<PublishNews>)request.getAttribute("pnlist");
              %>
              <tr>
                <td>
                <table border="0" cellpadding="3" cellspacing="3" style="margin-left:35px">
                	<tr>
                		<td colspan="2" class="content" style="font-weight: bold;">
                		<input type="hidden" name="exelistSize" value="<%= exlist.size()%>">
                		Select All<input type="checkbox" name="all" value="all" id="selectAll" onchange="javascript:check_all_in_document(this)"/></td>
                	</tr>
                	<%for(int i=0;i<exlist.size();i++){ 
                	
                	%>
                	<tr>
                		<td>
                		<input type="checkbox" name="exe<%=i+1 %>" id="exe<%=i+1 %>" value="<%=exlist.get(i).getId() %>" />
                		<%
                		if(pnlist!=null){
                		for(int j=0;j<pnlist.size();j++){
                			if(exlist.get(i).getId()==pnlist.get(j).getPublishedTo()){
                		%>
                		<script type="text/javascript">
                		$(document).ready(function() {
								//alert("dskjfl");
                			$('input:checkbox[name=exe<%=i+1%>]').attr('checked',true);
                			$('input:checkbox[name=exe<%=i+1%>]').attr('disabled',true);
                			
								});
                		</script>
                		
                		<%
                		
                			}
                			}
                		}
                		%>
                		
                		</td>
                		<td align="left" class="content"><%=exlist.get(i).getExeName() %></td>
                	</tr>
                	<%} %>
                </table>
                </td>
              </tr>
              <tr>
              <td>
              </td>
              </tr>
              <tr>
                <td height="5"></td>
              </tr>
            </table>
            </td>
 		 </tr>
         <tr>
            <td align="left" valign="top">
            
            <input type="submit" class="button-black-right" value="Approve" />   
            </td>
          </tr>
          <tr>
            <td height="10">
            	<div id="ajaxLoader" style="display:none" align="center"><img src="<%=application.getContextPath()%>/images/load.gif"/></div> 
            </td>
          </tr>
          <tr>
            <td align="right" valign="top">&nbsp;</td>
          </tr>
          <tr>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
        </table>
        </form>
        </div>
        
        </td>
        <td>&nbsp;</td>
      </tr>
	  <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
     </table></td>
  </tr>
  <tr>
    <td height="40" align="left" valign="top" bgcolor="#0B0B0B">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<script>
function check_all_in_document(ch)
{
	var c = new Array();
	  c = document.getElementsByTagName('input');
	if(ch.checked ==true){
		for (var i = 0; i < c.length; i++)
		  {
		    if (c[i].type == 'checkbox')
		    {
		      c[i].checked = true;
		    }
		  }
		}else{
			for (var i = 0; i < c.length; i++)
			  {
			    if (c[i].type == 'checkbox')
			    {
			      c[i].checked = false;
			    }
			  }
	
			}
}
</script>